import os
from openai import OpenAI

os.environ["OPENAI_API_KEY"] = 'sk-f2M0jWxDEb7IJKiuCnMsvKE7TLSYCA36pyl8gWA1XLaHnD8l'
os.environ["OPENAI_BASE_URL"] = 'https://api.f2gpt.com/v1'

client = OpenAI()

# text = client.invoke("请给我写一句情人节红玫瑰的中文宣传语")
response = client.chat.completions.create(
    n=10,
    model='gpt-4',
    messages=[
        {"role": "system", "content": "You are a creative AI."},
        {"role": "user", "content": "请给我的花店起个名"},
    ],
    temperature=0.8,
    max_tokens=600,
)
for i in range(10):
    print(response.choices[i].message.content)
# print(response.choices[0].message.content)
